// /rule/addRuleInfo.do
document.write('<script type="text/javascript" src="../static/js/back/utils.js"></script>');
document.write('<script type="text/javascript" src="../static/js/back/ajax.js"></script>');
var _url_ = '';
var _url_edit = '../sys/getLogsList';
var _url_list = '../sys/getSysLogsList';
var _url_id = '';
var _map = {};
///首页
var _pageNum = 1;
var _type ;
var spid="";
  $(function(){
	  if(_type === "add"){
	  }else if(_type === "edit"){
	  }else{
		 getList();
	  }
  })
$(function(){
	  $("body").on("click",".mypage span",function(){
		  _pageNum = $(this).attr("data-status");
		  getList();
	  })
	  $(".search-btn").click(function(){
			 var tabletitle =  $("#table-title").val();
			 _map["title"] = tabletitle;
			 _pageNum = 1;
			 getList();
		  });
	  $("body").on("click",".left-type li",function(){
			 var tt = $(this).text();
			 $(this).addClass('lt-li-active').siblings().removeClass('lt-li-active');
			 _map['goodsTypeId'] = $(this).attr('data-status');
			 getList();
	  });
});
  function getList(){
	  _map['pageNum'] = _pageNum;
	  _ajax_post(_url_list,_map,function(res){
		  if(!res.returnObject||res.returnObject.length<=0 ){
			  $(".layui-table tbody").html("");
			  $(".no-more-data").show();
			  $(".mypage").hide();
			  return;
		  }else{
			  $(".mypage").show();
			  $(".no-more-data").hide();
		  }
		  var html = "";
		  var stat = "" , statHtml = "";
		  showPageInfo(res.returnObject);
		  $(".x-right").text("共有数据："+res.returnObject.total +" 条");
		  var html,stat,statStr,typeStr,sendTypeStr;
		  $.each(res.returnObject.list,function(i,v,arr){
			  html+=' <tr><td>'
//			  	 +' <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id="'+v.id+'" ><i class="layui-icon">&#xe605;</i></div>'
//	             +' </td>  ' 
//			     +'<td>'
 	             + (i+res.returnObject.startRow)+'</td>                                                                                                             '
 	             +' <td>'+v.account
 	             +'</td>                                                                                           '
// 	             +' <td align="center"><a target="_blank" href="'+v.adUrl+'"><img  src="'+v.adPic+'" height=50 widht=50 ></a></td>                                                                                                      '
// 	             +' <td>'+v.adUrl+'</td>                                                                                                      '
 	             +' <td >'+v.groupName+'</td>'
 	             +' <td >'+v.handle+'</td>                                                                                                      '
 	             +' <td>'+v.ip+'</td>                                                                                                      '
 	             +' <td>'+v.createTime+'</td>                                                                                                      '
 	             +'</tr>';
		  })
		  $(".layui-table tbody").html(html);
	  })
  }
  
  /*用户-删除*/
  function member_del(obj,_id){
      layer.confirm('确认要删除吗？',function(index){
          //发异步删除数据
    	  _ajax_post_token(_url_edit,{status:0,id:_id},function(res){
    	      	console.log(res);
    	      	if(res.resultCode == 1000){
    	      		getList();
    	      	  layer.msg('删除成功!',{icon:6,time:2000});
    	      	}else{
    	      		layer.msg('删除失败!',{icon:5,time:2000});
    	      	}
    	      });
      });
  }
  function showQr(_title,_url){
	  layer.open({ title: _title,content:'<img width=250 height=250 src="'+_url+'" />' });
  }
  function showEditData(){
	  _url_ = _url_edit;
	  var _id = getUrlParam("id");
	  $("#paramKey").val(_id);
	  console.log(_id);
	  _ajax_post_token(_url_id,{id:_id},function(res){
		  console.log(res);
		  _showData = res.returnObject;
	  });
  }    
  function updateInfo(data){
	  //发异步，把数据提交给后台
	 data['shopId'] = spid;
      _ajax_post_token(_url_,data,function(res){
      	if(res.resultCode == 1000){
      	  parent.getList();
      	  parent.layer.msg('操作成功!',{icon:6,time:2000});
      	  x_admin_close();
          // 获得frame索引
      	}else{
      		layer.msg('操作失败!',{icon:5,time:2000});
      	}
      });
  }
      
  
  function delAll (argument) {
      var data = tableCheck.getData();
      if(!data || data.length==0){
    	  layer.msg('至少选择一条数据',{icon:5,time:2000});
    	  return;
      }
      console.log(data.join(","));
      layer.confirm('确认要删除已选择的数据吗？',function(index){
          //捉到所有被选中的，发异步进行删除
    	  _ajax_post_token(_url_edit,{ids:data.join(",")},function(res){
    	      	if(res.resultCode == 1000){
    	      	  getList();
    	      	  layer.msg('操作成功!',{icon:6,time:2000});
    	          // 获得frame索引
    	      	}else{
    	      		layer.msg('操作失败!',{icon:5,time:2000});
    	      	}
    	      });
      });
    }      
       
  function test(_d){
	  console.log(_d);
  }
      
//添加 和 修改窗口     